<input type = "file" name = "uploadfile" id = "upload" multiple/><br/>
<button id = "btnUp">Upload</button>

<script>
	$(document).ready(function(){
		$(document).on("click","#btnUp",function(){
			
			  /* var oMyForm = new FormData();
			  
				console.log($("#upload")[0].files[0]);
				
				oMyForm.append("name","mhdanh.png");
			   oMyForm.append("file", $("#upload")[0].files[0]);
			 
			  $.ajax({
			    url: ctxPath + "/api/uploadFile",
			    data: oMyForm,
			    dataType: 'text',
			    processData: false,
			    contentType: false,
			    method: 'POST',
			    success: function(data){
			      alert(data);
			    }
			  }); */
			  
			var oMyForm = new FormData();
			  			
			oMyForm.append("name","mhdanh.png");
			for(var i = 0;i<$("#upload")[0].files.length;i++)
		   	{
				console.log($("#upload")[0].files[i]);
				oMyForm.append("name[]","name"+i);
				oMyForm.append("file[]", $("#upload")[0].files[i]);
		   			
		   	}
			
		 
		  $.ajax({
		    url: ctxPath + "/api/uploadMultipleFile",
		    data: oMyForm,
		    dataType: 'text',
		    processData: false,
		    contentType: false,
		    method: 'POST',
		    success: function(data){
		      console.log(data);
		    }
		  });
		});
	});
</script>